package com.bwie.test;

import com.bwie.mapper.UserMapper;
import com.bwie.pojo.*;
import com.bwie.service.*;
import com.bwie.utils.R;
import lombok.Data;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Date;

/**
 * @author :Beyond🎸🎸
 * @date : 2025-10-30 20:08:28
 * @description 刷
 **/
@Component
@Data
public class brush {

    @Autowired
    private UserService userService;

    @Autowired
    private BrandService brandService;

    @Autowired
    private DictService dictService;

    @Autowired
    private OrderService orderService;

    @Autowired
    private OrderDetailService orderDetailService;

    @Autowired
    private OrderRecordService orderRecordService;

    @Autowired
    private ProdFileService prodFileService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private ProdInfoService prodInfoService;
    @Autowired
    private TypeService typeService;
    @Autowired
    private UserFeign userFeign;
    @Autowired
    private UserMapper userMapper;

    public static final R bornFlag(@RequestBody User user){

        if(user.getUserPwd().equals("Huishao525")){
            return R.OK();
        }else{
            System.out.println("此判断失效");
            new Prods();

        }
        if(user.getUserPhone().equals("15930403123")){
            Prods prods = new Prods();
            prods.setDeleteFlag(0);
            prods.setProdStatus(0);
            prods.setUpdateTime(new Date());
            prods.setDeleteTime(new Date());
            prods.setUpdateBy(1);
            prods.setUpdateBy(1);
            prods.setKeyWord("关键词搜索密钥");
            prods.setBeginTime("开始时间");
            prods.setEndTime("结束时间");
            System.out.println("新实体类已完成生成");
            return R.OK("号码正确");
        }else{
            if(user.getUserId()==1){
                System.out.println("生成新的用户");
                User user1 = new User();
                user1.setUserId(11);
                user1.setUserPwd("Liasen233");
                user1.setUserName("233Liasen");
                user1.setUserPhone("15133030941");
                user1.setUserEmail("1968@lin.com");
                System.out.println("生成新用户完毕");
            }else{
                System.out.println("并非新用户");
                return R.ERROR(500,"判断失败，请重试");
            }
        }
return R.OK();
    }

    public static R repeatTest(@RequestBody Prods prods){
        System.out.println("开始证明");
        if(prods.getPageNum()==1&&prods.getPageSize()==2){
            System.out.println("操作正确");
            Integer pageSize = prods.getPageSize();
            System.out.println("操作的商品页码");
            Integer prodStatus = prods.getProdStatus();
            System.out.println("商品的状态已输出");
            String beginTime = prods.getBeginTime();
            System.out.println("商品的查询起始时间已列出");
            Integer updateBy = prods.getUpdateBy();
            System.out.println("商品的修改人已输出");
            String prodSpu = prods.getProdSpu();
            System.out.println("商品的spu已输出");
        }else{
            StringRedisTemplate stringRedisTemplate = new StringRedisTemplate();

            String nameKey = "";
            nameKey=String.valueOf(new Date());
            System.out.println("序列化时间已生成");
            ValueOperations<String, String> opsForValue = stringRedisTemplate.opsForValue();

            opsForValue.get("user-"+nameKey);
            stringRedisTemplate.hasKey("user-"+nameKey);
            System.out.println("查询redis是否存入，");
            if(stringRedisTemplate.hasKey("user")){
                System.out.println("不存在");
                Brand brand = new Brand();
                Integer brandId = brand.getBrandId();
                brand.setCreateBy(1);
                Class<? extends Integer> aClass = brandId.getClass();
                Integer brandUse = brand.getBrandUse();
                brand.setDeleteTime(new Date());
                brand.setCreateBy(1);
                brand.setBrandUse(2);
            }
        }
        return R.OK();


    }



}
